﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WisDom.SmartTMS.Entity;

namespace WisDom.SmartTMS.Validator
{
    /// <summary>
    /// 离职办理的验证器
    /// 离职办理实体类映射文件（FluentApi来配置映射规则）
    /// 必须继承这个EFcore里面的基类
    /// </summary>
    public class LeaveDealValidator : IEntityTypeConfiguration<LeaveDeal>
    {
        public void Configure(EntityTypeBuilder<LeaveDeal> builder)
        {
            builder.ToTable("LeaveDeal");
            builder.Property("LDName").HasMaxLength(50).IsRequired();
            builder.Property("DpID").HasMaxLength(50).IsRequired();
            builder.Property("Position").HasMaxLength(50).IsRequired();
            builder.Property("Principal").HasMaxLength(50).IsRequired();
            builder.Property("Reasons").HasMaxLength(50).IsRequired();
            builder.Property("ApprovalStatus").HasMaxLength(50).IsRequired();
            builder.Property("EntryTimes").HasColumnType("date").IsRequired();
            builder.Property("LastDay").HasColumnType("date").IsRequired();
            builder.Property("CreateTimes").HasColumnType("date").IsRequired();
        }
    }
}
